function out = condFQ_i(y,id,groupid,dataP,dataQ)

ker_bi = @(t) 15*(1-t.^2).^2.*(abs(t)<=1)/16;
T = length(dataP);

firms = find(groupid==id);
lfirms = length(firms);

preout = NaN*ones(lfirms,2);

for k = 1:lfirms
    dataQi = dataQ(:,firms(k));
    h = 1.06*std(dataQi)*T^(-.4);
    temp_ker = ker_bi((dataQi-min(dataQi))/h);
    
    Ytemp1 = (sum(dataQ,2)-dataQi<=y(1));
    preout(k,1) = sum(Ytemp1.*temp_ker)/sum(temp_ker);
    
    Ytemp2 = (dataP<=y(2));
    preout(k,2) = sum(Ytemp2.*temp_ker)/sum(temp_ker);
end

out = mean(preout);
